import React, { Component } from "react";
import { inject, observer } from "mobx-react";

@inject("apple")
@observer
class PickApple extends Component {
    pickApple(){
        const {pickable,applePick} = this.props.apple
        if(pickable===true){
            applePick()

        }else{
            return;
        }
    }
    render() {
        const {pickable} =this.props.apple
        return <div className="button-box">
            <button onClick={this.pickApple.bind(this)} className={pickable===true?"pick-button pickable":"pick-button pickdisable"}>{pickable===true?"摘苹果":"正在采摘..."}</button>
        </div>
    }
}
export default PickApple